<script type="text/javascript" src="/scripts/utilities.js"></script>
<div  class="">
<form enctype="multipart/form-data" id="messageform" name="messageform" method="POST" action="/triggers/index/save" >
<div id="divAbout" style="color:red;">
<?php if($ctx->message!="")
	{
		$message=$ctx->message;
		}
		else $message=""; ?>
</div>
<div><textarea class="CrtTextaera" id="message" name="message"  onKeyDown="limitText(this,300,'divAbout');"><?php echo $message; ?></textarea></div>
<div class="pad_t8"><?php if($ctx->message==""){ ?><input type="radio" name="radio" value ="personal" checked="checked" onchange="showGroups(this)"/><label>Personal&nbsp;&nbsp;&nbsp;</label><?php }?><input type="radio" name="radio" value ="group" onchange="showGroups(this)"/><label>Group&nbsp;&nbsp;&nbsp;</label><input type="radio" name="radio" value ="public" onchange="showGroups(this)"/><label>Public &nbsp;&nbsp;&nbsp;</label>
</div>
<div class="pad_t8" id="div1">
</div>
<div class="clear"></div>
<div class="pad_t8"><a class="Button" href="javascript:void(0);" onclick="create(document.messageform);"><span><?php echo $ctx->label; ?></span></a><a class="Button" href="javascript:void(0);" onclick="javascript:tb_remove();"><span>Cancel</span></a></div>
<div class="clear"></div>
</form>
</div>
<script>
//<![CDATA[
function showGroups(obj)
{
	//alert(obj.value);return false;
	if(obj.value == "group")
	document.getElementById('div1').innerHTML = '<div><label>Select Group</div></label><select id="group" name="group[]" class="medium" size=4 multiple><option value="0" >--- Options ---</option><?php $i=0;while($i<($ctx->count)){ ?><option value="<?php echo $ctx->groups[$i]['group_id']; ?>"><?php echo $ctx->groups[$i]['name']; ?></option><?php $i++; }?></select>';
	
	else  document.getElementById('div1').innerHTML='';

}

function create(frm)
{
	var result = false;
	//alert(frm.message);return false;
	result = !isEmpty(frm.message, "${php: this.translate('errmsg_message')}") ;
	if(result)
	{
		$('#messageform').submit();
	}
	//alert(result);
	//return result;
}
//]]>
</script>
